{% extends 'base.html' %}
{% block class_book %}
    class='active'
{% endblock %}
{% block body %}
    <div class="panel panel-primary">
        <div class="panel-heading text-center">
            <h3 class="panel-title">图书列表</h3>
        </div>
        <div class="panel-body">
            <table class="table table-striped table-bordered table-hover">
                <tr>
                    <th>序号</th>
                    <th>ID</th>
                    <th>图书</th>
                    <th>出版社</th>
                    <th>操作</th>
                </tr>
                {% for book in book_list %}
                    <tr>
                        <td>{{ forloop.counter }}</td>
                        <td>{{ book.pk }}</td>
                        <td>{{ book.book_name }}</td>
                        <td>{{ book.pub.name }}</td>
                        <td>
                            <a href="{% url 'alter_book' book.id %}"
                               class="ben btn-primary btn-sm">修改</a>
                            <a href="/del_book/{{ book.id }}/"
                               class="ben btn-danger btn-sm">删除</a>
                        </td>
                    </tr>
                {% endfor %}
            </table>
            <a href="{% url 'add_book' %}" class="btn btn-primary">新增</a>
        </div>
    </div>
{% endblock %}